<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>lacewing.packetloaders.file</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="lacewing-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://mathias.aquadasoft.com">Python Lacewing Library</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="lacewing-module.html">Package&nbsp;lacewing</a> ::
        <a href="lacewing.packetloaders-module.html">Package&nbsp;packetloaders</a> ::
        Module&nbsp;file
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="lacewing.packetloaders.file-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="lacewing.packetloaders.file-module.html" onclick="show_private();">Module lacewing.packetloaders.file</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno"> 1</tt>  <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
<a name="L2"></a><tt class="py-lineno"> 2</tt>  <tt class="py-line"><tt class="py-docstring">File sending features</tt> </tt>
<a name="L3"></a><tt class="py-lineno"> 3</tt>  <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
<a name="L4"></a><tt class="py-lineno"> 4</tt>  <tt class="py-line"> </tt>
<a name="L5"></a><tt class="py-lineno"> 5</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">struct</tt> <tt class="py-keyword">import</tt> <tt class="py-name">unpack_from</tt><tt class="py-op">,</tt> <tt class="py-name">pack</tt><tt class="py-op">,</tt> <tt class="py-name">calcsize</tt> </tt>
<a name="L6"></a><tt class="py-lineno"> 6</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-0" class="py-name" targets="Package lacewing=lacewing-module.html"><a title="lacewing" class="py-name" href="#" onclick="return doclink('link-0', 'lacewing', 'link-0');">lacewing</a></tt><tt class="py-op">.</tt><tt id="link-1" class="py-name" targets="Module lacewing.baseloader=lacewing.baseloader-module.html"><a title="lacewing.baseloader" class="py-name" href="#" onclick="return doclink('link-1', 'baseloader', 'link-1');">baseloader</a></tt> <tt class="py-keyword">import</tt> <tt class="py-name">_BaseLoader</tt> </tt>
<a name="L7"></a><tt class="py-lineno"> 7</tt>  <tt class="py-line"> </tt>
<a name="L8"></a><tt class="py-lineno"> 8</tt>  <tt class="py-line"><tt class="py-string">"""</tt> </tt>
<a name="L9"></a><tt class="py-lineno"> 9</tt>  <tt class="py-line"><tt class="py-string">// File packets memo:</tt> </tt>
<a name="L10"></a><tt class="py-lineno">10</tt>  <tt class="py-line"><tt class="py-string">//</tt> </tt>
<a name="L11"></a><tt class="py-lineno">11</tt>  <tt class="py-line"><tt class="py-string">// OPT_CS_RequestFileSend</tt> </tt>
<a name="L12"></a><tt class="py-lineno">12</tt>  <tt class="py-line"><tt class="py-string">// [byte Type (0 - Server, 1 - Channel, 2 - Peer)</tt> </tt>
<a name="L13"></a><tt class="py-lineno">13</tt>  <tt class="py-line"><tt class="py-string">// For channel or peer - [short Channel/Peer ID]</tt> </tt>
<a name="L14"></a><tt class="py-lineno">14</tt>  <tt class="py-line"><tt class="py-string">// [char Subchannel]</tt> </tt>
<a name="L15"></a><tt class="py-lineno">15</tt>  <tt class="py-line"><tt class="py-string">// [64 bit integer Size, short SenderID, string Filename]</tt> </tt>
<a name="L16"></a><tt class="py-lineno">16</tt>  <tt class="py-line"><tt class="py-string">//</tt> </tt>
<a name="L17"></a><tt class="py-lineno">17</tt>  <tt class="py-line"><tt class="py-string">//</tt> </tt>
<a name="L18"></a><tt class="py-lineno">18</tt>  <tt class="py-line"><tt class="py-string">// OPT_SC_RequestFileSend</tt> </tt>
<a name="L19"></a><tt class="py-lineno">19</tt>  <tt class="py-line"><tt class="py-string">// [byte Type (0 - Server, 1 - Channel, 2 - Peer)</tt> </tt>
<a name="L20"></a><tt class="py-lineno">20</tt>  <tt class="py-line"><tt class="py-string">// For channel or peer - [short Channel ID]</tt> </tt>
<a name="L21"></a><tt class="py-lineno">21</tt>  <tt class="py-line"><tt class="py-string">// For peer - [short Peer ID]</tt> </tt>
<a name="L22"></a><tt class="py-lineno">22</tt>  <tt class="py-line"><tt class="py-string">// [char Subchannel]</tt> </tt>
<a name="L23"></a><tt class="py-lineno">23</tt>  <tt class="py-line"><tt class="py-string">// [64 bit integer Size, short SenderID, string Filename]</tt> </tt>
<a name="L24"></a><tt class="py-lineno">24</tt>  <tt class="py-line"><tt class="py-string">//</tt> </tt>
<a name="L25"></a><tt class="py-lineno">25</tt>  <tt class="py-line"><tt class="py-string">//</tt> </tt>
<a name="L26"></a><tt class="py-lineno">26</tt>  <tt class="py-line"><tt class="py-string">// OPT_*_AcceptFileReceive</tt> </tt>
<a name="L27"></a><tt class="py-lineno">27</tt>  <tt class="py-line"><tt class="py-string">// [short SenderID, short ReceiverID]</tt> </tt>
<a name="L28"></a><tt class="py-lineno">28</tt>  <tt class="py-line"><tt class="py-string">//</tt> </tt>
<a name="L29"></a><tt class="py-lineno">29</tt>  <tt class="py-line"><tt class="py-string">// OPT_*_FileChunk</tt> </tt>
<a name="L30"></a><tt class="py-lineno">30</tt>  <tt class="py-line"><tt class="py-string">// [short ReceiverID, char[] data]</tt> </tt>
<a name="L31"></a><tt class="py-lineno">31</tt>  <tt class="py-line"><tt class="py-string">"""</tt> </tt>
<a name="L32"></a><tt class="py-lineno">32</tt>  <tt class="py-line"> </tt>
<a name="L33"></a><tt class="py-lineno">33</tt>  <tt class="py-line"><tt class="py-comment"># don't wanna implement this yet v_v</tt> </tt>
<a name="L34"></a><tt class="py-lineno">34</tt>  <tt class="py-line"> </tt>
<a name="_UnimplementedLoader"></a><div id="_UnimplementedLoader-def"><a name="L35"></a><tt class="py-lineno">35</tt> <a class="py-toggle" href="#" id="_UnimplementedLoader-toggle" onclick="return toggle('_UnimplementedLoader');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="lacewing.packetloaders.file._UnimplementedLoader-class.html">_UnimplementedLoader</a><tt class="py-op">(</tt><tt class="py-base-class">_BaseLoader</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="_UnimplementedLoader-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="_UnimplementedLoader-expanded"><a name="_UnimplementedLoader.read"></a><div id="_UnimplementedLoader.read-def"><a name="L36"></a><tt class="py-lineno">36</tt> <a class="py-toggle" href="#" id="_UnimplementedLoader.read-toggle" onclick="return toggle('_UnimplementedLoader.read');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="lacewing.packetloaders.file._UnimplementedLoader-class.html#read">read</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">data</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="_UnimplementedLoader.read-collapsed" style="display:none;" pad="++" indent="++++++++"></div><div id="_UnimplementedLoader.read-expanded"><a name="L37"></a><tt class="py-lineno">37</tt>  <tt class="py-line">        <tt class="py-keyword">raise</tt> <tt class="py-name">NotImplementedError</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
</div><a name="L38"></a><tt class="py-lineno">38</tt>  <tt class="py-line">     </tt>
<a name="_UnimplementedLoader.generate"></a><div id="_UnimplementedLoader.generate-def"><a name="L39"></a><tt class="py-lineno">39</tt> <a class="py-toggle" href="#" id="_UnimplementedLoader.generate-toggle" onclick="return toggle('_UnimplementedLoader.generate');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="lacewing.packetloaders.file._UnimplementedLoader-class.html#generate">generate</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="_UnimplementedLoader.generate-collapsed" style="display:none;" pad="++" indent="++++++++"></div><div id="_UnimplementedLoader.generate-expanded"><a name="L40"></a><tt class="py-lineno">40</tt>  <tt class="py-line">        <tt class="py-keyword">raise</tt> <tt class="py-name">NotImplementedError</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
</div></div><a name="L41"></a><tt class="py-lineno">41</tt>  <tt class="py-line"> </tt>
<a name="L42"></a><tt class="py-lineno">42</tt>  <tt class="py-line"><tt class="py-comment"># common</tt> </tt>
<a name="_RequestFile"></a><div id="_RequestFile-def"><a name="L43"></a><tt class="py-lineno">43</tt> <a class="py-toggle" href="#" id="_RequestFile-toggle" onclick="return toggle('_RequestFile');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="lacewing.packetloaders.file._RequestFile-class.html">_RequestFile</a><tt class="py-op">(</tt><tt class="py-base-class">_UnimplementedLoader</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="_RequestFile-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="_RequestFile-expanded"><a name="L44"></a><tt class="py-lineno">44</tt>  <tt class="py-line">    <tt class="py-keyword">pass</tt> </tt>
</div><a name="L45"></a><tt class="py-lineno">45</tt>  <tt class="py-line"> </tt>
<a name="_FileHandle"></a><div id="_FileHandle-def"><a name="L46"></a><tt class="py-lineno">46</tt> <a class="py-toggle" href="#" id="_FileHandle-toggle" onclick="return toggle('_FileHandle');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="lacewing.packetloaders.file._FileHandle-class.html">_FileHandle</a><tt class="py-op">(</tt><tt class="py-base-class">_UnimplementedLoader</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="_FileHandle-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="_FileHandle-expanded"><a name="L47"></a><tt class="py-lineno">47</tt>  <tt class="py-line">    <tt class="py-keyword">pass</tt> </tt>
</div><a name="L48"></a><tt class="py-lineno">48</tt>  <tt class="py-line"> </tt>
<a name="_FileChunk"></a><div id="_FileChunk-def"><a name="L49"></a><tt class="py-lineno">49</tt> <a class="py-toggle" href="#" id="_FileChunk-toggle" onclick="return toggle('_FileChunk');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="lacewing.packetloaders.file._FileChunk-class.html">_FileChunk</a><tt class="py-op">(</tt><tt class="py-base-class">_UnimplementedLoader</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="_FileChunk-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="_FileChunk-expanded"><a name="L50"></a><tt class="py-lineno">50</tt>  <tt class="py-line">    <tt class="py-keyword">pass</tt> </tt>
</div><a name="L51"></a><tt class="py-lineno">51</tt>  <tt class="py-line">     </tt>
<a name="L52"></a><tt class="py-lineno">52</tt>  <tt class="py-line"><tt class="py-comment"># sc</tt> </tt>
<a name="L53"></a><tt class="py-lineno">53</tt>  <tt class="py-line"> </tt>
<a name="RequestClientFile"></a><div id="RequestClientFile-def"><a name="L54"></a><tt class="py-lineno">54</tt> <a class="py-toggle" href="#" id="RequestClientFile-toggle" onclick="return toggle('RequestClientFile');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="lacewing.packetloaders.file.RequestClientFile-class.html">RequestClientFile</a><tt class="py-op">(</tt><tt class="py-base-class">_RequestFile</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="RequestClientFile-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="RequestClientFile-expanded"><a name="L55"></a><tt class="py-lineno">55</tt>  <tt class="py-line">    <tt class="py-keyword">pass</tt> </tt>
</div><a name="L56"></a><tt class="py-lineno">56</tt>  <tt class="py-line"> </tt>
<a name="ServerFile"></a><div id="ServerFile-def"><a name="L57"></a><tt class="py-lineno">57</tt> <a class="py-toggle" href="#" id="ServerFile-toggle" onclick="return toggle('ServerFile');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="lacewing.packetloaders.file.ServerFile-class.html">ServerFile</a><tt class="py-op">(</tt><tt class="py-base-class">_FileHandle</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="ServerFile-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="ServerFile-expanded"><a name="L58"></a><tt class="py-lineno">58</tt>  <tt class="py-line">    <tt class="py-keyword">pass</tt> </tt>
</div><a name="L59"></a><tt class="py-lineno">59</tt>  <tt class="py-line"> </tt>
<a name="ServerFileChunk"></a><div id="ServerFileChunk-def"><a name="L60"></a><tt class="py-lineno">60</tt> <a class="py-toggle" href="#" id="ServerFileChunk-toggle" onclick="return toggle('ServerFileChunk');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="lacewing.packetloaders.file.ServerFileChunk-class.html">ServerFileChunk</a><tt class="py-op">(</tt><tt class="py-base-class">_FileChunk</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="ServerFileChunk-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="ServerFileChunk-expanded"><a name="L61"></a><tt class="py-lineno">61</tt>  <tt class="py-line">    <tt class="py-keyword">pass</tt> </tt>
</div><a name="L62"></a><tt class="py-lineno">62</tt>  <tt class="py-line"> </tt>
<a name="L63"></a><tt class="py-lineno">63</tt>  <tt class="py-line"><tt class="py-comment"># cs</tt> </tt>
<a name="L64"></a><tt class="py-lineno">64</tt>  <tt class="py-line"> </tt>
<a name="RequestServerFile"></a><div id="RequestServerFile-def"><a name="L65"></a><tt class="py-lineno">65</tt> <a class="py-toggle" href="#" id="RequestServerFile-toggle" onclick="return toggle('RequestServerFile');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="lacewing.packetloaders.file.RequestServerFile-class.html">RequestServerFile</a><tt class="py-op">(</tt><tt class="py-base-class">_RequestFile</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="RequestServerFile-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="RequestServerFile-expanded"><a name="L66"></a><tt class="py-lineno">66</tt>  <tt class="py-line">    <tt class="py-keyword">pass</tt> </tt>
</div><a name="L67"></a><tt class="py-lineno">67</tt>  <tt class="py-line"> </tt>
<a name="ClientFile"></a><div id="ClientFile-def"><a name="L68"></a><tt class="py-lineno">68</tt> <a class="py-toggle" href="#" id="ClientFile-toggle" onclick="return toggle('ClientFile');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="lacewing.packetloaders.file.ClientFile-class.html">ClientFile</a><tt class="py-op">(</tt><tt class="py-base-class">_FileHandle</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="ClientFile-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="ClientFile-expanded"><a name="L69"></a><tt class="py-lineno">69</tt>  <tt class="py-line">    <tt class="py-keyword">pass</tt> </tt>
</div><a name="L70"></a><tt class="py-lineno">70</tt>  <tt class="py-line"> </tt>
<a name="ClientFileChunk"></a><div id="ClientFileChunk-def"><a name="L71"></a><tt class="py-lineno">71</tt> <a class="py-toggle" href="#" id="ClientFileChunk-toggle" onclick="return toggle('ClientFileChunk');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="lacewing.packetloaders.file.ClientFileChunk-class.html">ClientFileChunk</a><tt class="py-op">(</tt><tt class="py-base-class">_FileChunk</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="ClientFileChunk-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="ClientFileChunk-expanded"><a name="L72"></a><tt class="py-lineno">72</tt>  <tt class="py-line">    <tt class="py-keyword">pass</tt> </tt>
</div><a name="L73"></a><tt class="py-lineno">73</tt>  <tt class="py-line"> </tt>
<a name="L74"></a><tt class="py-lineno">74</tt>  <tt class="py-line"><tt class="py-name">__all__</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-string">'RequestClientFile'</tt><tt class="py-op">,</tt> <tt class="py-string">'ServerFile'</tt><tt class="py-op">,</tt> <tt class="py-string">'ServerFileChunk'</tt><tt class="py-op">,</tt> </tt>
<a name="L75"></a><tt class="py-lineno">75</tt>  <tt class="py-line">    <tt class="py-string">'RequestServerFile'</tt><tt class="py-op">,</tt> <tt class="py-string">'ClientFile'</tt><tt class="py-op">,</tt> <tt class="py-string">'ClientFileChunk'</tt><tt class="py-op">]</tt> </tt>
<a name="L76"></a><tt class="py-lineno">76</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="lacewing-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://mathias.aquadasoft.com">Python Lacewing Library</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Thu Sep 16 22:07:42 2010
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
